﻿using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Web;
using WooCoo.Web.MVC;
using WooCoo.DataPortal;
using WooCoo.Portal.Contracts;
using System.Web.Mvc;
using System.Web.Routing;
using System.Web.Optimization;

namespace WooCoo.Portal.Web
{
    /// <summary>
    /// Portal的模块信息，用于模块初始化
    /// </summary>
    [Export(typeof(IModule))]
    public class PortalWebModule : IWebModule
    {
        public PortalWebModule()
        {
            var jsList = new string[] { 
                "resource.js"                
            };
            foreach (var js in jsList)
                BundleTable.Bundles.Add(new ScriptBundle("~/Areas/Support/" + js).Include("~/Areas/Support/Models/" + js));
        }
        public string GetCommonParameter(string paraType, string code)
        {
            throw new NotImplementedException();
        }

        public string GetHashParameter(string hashType, string hashKey)
        {
            return DataPortalClient.Default.Execute<ISupportService, string>(o => o.GetHashParameter(hashType, hashKey));
        }

        public string ModuleName
        {
            get { return "WooCoo.Portal.Web"; }
        }


        public RedirectToRouteResult FirstPage
        {
            get { return new RedirectToRouteResult(
                new RouteValueDictionary { 
                { "action", "Index" }, { "controller", "Home" }, { "area", "Support" }}); }
        }
    }
}